﻿#include "mediaimgserver.h"

MediaImgServer::MediaImgServer(QObject *parent)
{

}

MediaImgServer &MediaImgServer::getInstance()
{
    static MediaImgServer ms;
    return ms;
}

void MediaImgServer::incomingConnection(qintptr handle)
{
    MediaImgSocket* socket = new MediaImgSocket;
    socket->setSocketDescriptor(handle);
    list.append(socket);
}

void MediaImgServer::tranData(QByteArray ba, QString id)
{
    for(auto x:list)
    {
        if(x->getId()==id)
        {
            x->write(ba);
            break;
        }
    }
}
